package org.afs.gescol.core.model.params;

import java.util.Calendar;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.afs.gescol.core.model.references.Cycle;
import org.afs.gescol.core.model.references.Hourly;
import org.hibernate.annotations.ForeignKey;
import org.scub.foundation.framework.core.model.BaseModel;

/**
 * Hourly time for each school cycle.
 * @author Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
@Entity
@Table(name = "param_hourly_time")
@AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "hourly_time_id", nullable = false)),
    @AttributeOverride(name = "version", column = @Column(name = "hourly_time_version", nullable = false, unique = false)),
})
public class HourlyTime extends BaseModel {

    /** Serial Version UID. */
    private static final long serialVersionUID = 1022933756285667011L;

    @ManyToOne
    @JoinColumn(name = "hourly_id")
    @ForeignKey(name = "fk_param_hourly_time_ref_hourly_id")
    private Hourly hourly;

    @ManyToOne
    @JoinColumn(name = "cycle_id")
    @ForeignKey(name = "fk_param_hourly_time_ref_cycle_id")
    private Cycle cycle;

    @Column(name = "hourly_begin_hour")
    private Calendar beginHour;

    @Column(name = "hourly_end_hour")
    private Calendar endHour;

    /**
     * Get the value of hourly.
     * @return the hourly
     */
    public Hourly getHourly() {
        return hourly;
    }

    /**
     * Set the value of hourly.
     * @param hourly the hourly to set
     */
    public void setHourly(Hourly hourly) {
        this.hourly = hourly;
    }

    /**
     * Get the value of cycle.
     * @return the cycle
     */
    public Cycle getCycle() {
        return cycle;
    }

    /**
     * Set the value of cycle.
     * @param cycle the cycle to set
     */
    public void setCycle(Cycle cycle) {
        this.cycle = cycle;
    }

    /**
     * Get the value of beginHour.
     * @return the beginHour
     */
    public Calendar getBeginHour() {
        return beginHour;
    }

    /**
     * Set the value of beginHour.
     * @param beginHour the beginHour to set
     */
    public void setBeginHour(Calendar beginHour) {
        this.beginHour = beginHour;
    }

    /**
     * Get the value of endHour.
     * @return the endHour
     */
    public Calendar getEndHour() {
        return endHour;
    }

    /**
     * Set the value of endHour.
     * @param endHour the endHour to set
     */
    public void setEndHour(Calendar endHour) {
        this.endHour = endHour;
    }

    @Override
    public boolean equals(Object other) {
        return equalsUtil(other);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

}
